﻿#region zh-CHS 2006 - 2010 DemoSoft 团队 | en 2006-2010 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the MMOSE(Massively Multiplayer Online Server Engine) for .NET.
//
//                              2006-2010 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace Demo.Mmose.Core.Entity.Suit.Spell
{
    /// <summary>
    ///  开始施法
    /// </summary>
    public static class SpellCast
    {
        #region zh-CHS 共有属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private static SpellHandlers s_SpellHandlers = new SpellHandlers();
        #endregion
        /// <summary>
        ///  
        /// </summary>
        public static SpellHandlers SpellHandlers
        {
            get { return s_SpellHandlers; }
        }

        /// <summary>
        /// 初始化
        /// </summary>
        public static void Init( SpellHandlers spellHandlers )
        {
            if ( spellHandlers == null )
                throw new Exception( "SpellCast.Init(...) - spellHandlers == null error!" );

            s_SpellHandlers = spellHandlers;
        }

        #endregion

        #region zh-CHS 共有静态方法 | en Public Static Methods
        /// <summary>
        /// 开始抛出技能(同步)
        /// </summary>
        /// <param name="spellId"></param>
        /// <param name="passiveCast"></param>
        public static void StartCast( long spellId, Spell spell, object arg )
        {
            if ( s_SpellHandlers == null )
                throw new Exception( "SpellCast.Init(...) - s_SpellHandlers == null error!" );

            ISpellHandler spellHandler = s_SpellHandlers.GetHandler( spellId );
            if ( spellHandler != null )
                spellHandler.Cast( spell, arg );
        }

        /// <summary>
        /// 开始抛出技能（异步）
        /// </summary>
        /// <param name="spellId"></param>
        /// <param name="passiveCast"></param>
        public static void AsyncStartCast( long spellId, Spell spell, object arg )
        {
            throw new NotImplementedException();
        }
        #endregion
    }
}
#endregion